<?php
/**
 * Template Name: Home
 */

get_header() ?>

<script type="text/javascript" charset="utf-8">
	var slideshowSpeed = 4000;

	// Variable to store the images we need to set as background
	// which also includes some text and url's.	
	var photos = [
	<?php 
	while (have_posts()) : the_post();
	$pageID = get_the_ID();
	if (class_exists('MultiPostThumbnails')) {
		$numimg = 0;
		for ($i=1; $i < 16; $i++) { 
			if ( MultiPostThumbnails::has_post_thumbnail('page', 'image-'.$i) ) {
				echo '{ "image" : "'.wp_get_attachment_url(MultiPostThumbnails::get_post_thumbnail_id('page', 'image-'.$i, $pageID)).'"}, ';
				$numimg++;
			}
		}
	}
	
	if ($numimg == 0) {
		for ($i=1; $i < 5; $i++) { 
			echo '{ "image" : "'.get_bloginfo('stylesheet_directory').'/images/home/s_img'.$i.'.jpg" }, ';
		}
	}
	
	endwhile;
	
	?>
	];
</script>

<script src="<?php bloginfo('stylesheet_directory'); ?>/js/wv-bg.js"></script>
<table cellspacing="0px" cellpadding="0px" border="0" class="mainbox">
	<div id="headerimgs">
	    <div id="headerimg1" class="headerimg"></div>
	    <div id="headerimg2" class="headerimg"></div>
	</div>
	<tr><td valign="top">
		<table cellspacing="0px" cellpadding="0px" border="0" class="menubar">
       		<tr>
           		<td width="360px"><a href="<?php echo home_url('/') ?>"><img src="<?php bloginfo('stylesheet_directory')?>/images/logo.png" border="0" height="66px" width="223px"></a></td>
				<?php wv_top_menu() ?>
       		</tr>
   		</table><!-- table menu -->
	</td></tr>
</table>

<?php //get_sidebar(); ?>
<?php get_footer(); ?>
